<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
        var year = 1000;
        var k = 0;
        for(year = 1000;year<=2000;year++){
            if(year%4 == 0 && year%100 != 0 || year%100 ==0){               
                if(k%4==0 && k!=0){
                    document.write('<br>');
                }
                document.write(year+'   ');
                k++;
            }  
        }
    </script>
</body>
</html>